package com.lupengning.es.test.index;

import java.io.IOException;
import org.apache.http.HttpHost;
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

public class ESTest_Index_Delete {

  public static void main(String[] args) throws IOException {
    RestHighLevelClient esClient = new RestHighLevelClient(
        RestClient.builder(new HttpHost("192.168.56.10", 9200, "http"))
    );

    DeleteIndexRequest request = new DeleteIndexRequest("employee");

    AcknowledgedResponse response = esClient.indices().delete(request, RequestOptions.DEFAULT);

    System.out.println(response.isAcknowledged());

    esClient.close();
  }
}
